<?php

/**
 * BuddyPress - Users Home
 *
 * @package BuddyPress
 * @subpackage bp-default
 */

get_header( 'buddypress' );

	// IF THE USER IS NOT LOGGED IN, AND THE DISPLAYED USER IS NOT A PUBLIC SSA PROFILE, or YOUR OWN PROFILE, SHOW NOT FOUND
	if ( (!is_user_logged_in() && !is_ssa( bp_displayed_user_id()) && !is_god()) || (!is_ssa( bp_displayed_user_id() ) && !bp_is_my_profile()) ) :  ?>
	
		<div id="container">
			<div id="content" role="main">
				<div id="post-0" class="post error404 not-found">
					<p class="page-title">Not Found</p>
					<div class="entry-content">
                        <p>Apologies, but the page you requested could not be found.</p>
                        <p>Try browsing the <a href="<?php echo site_url('short-sale-assistants'); ?>">Short Sale Assistant Directory</a> instead.</p>
					</div><!-- .entry-content -->
				</div><!-- #post-0 -->
			</div><!-- #content -->
		</div><!-- #container -->
		
	<?php else : ?>
	
		<div id="container">
			<div id="content">
	
				<?php do_action( 'bp_before_member_home_content' ); ?>
	
				<div id="item-header" role="complementary">
	
					<?php locate_template( array( 'members/single/member-header.php' ), true ); ?>
	
				</div><!-- #item-header -->
	
				<?php if ( is_ap(bp_displayed_user_id()) ) { ?><div id="ap"><?php } ?>
                    <div id="item-nav">
                        <div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
                            <ul>
        
                                <?php bp_get_displayed_user_nav(); ?>
        
                                <?php do_action( 'bp_member_options_nav' ); ?>
        
                            </ul>
                        </div>
                    </div><!-- #item-nav -->
				<?php if ( is_ap() ) { ?></div><?php } ?>
	
				<div id="item-body">
	
					<?php do_action( 'bp_before_member_body' );
	
					if ( bp_is_user_activity() || !bp_current_component() ) :
						locate_template( array( 'members/single/activity.php'  ), true );
	
					elseif ( bp_is_user_messages() ) :
						locate_template( array( 'members/single/messages.php'  ), true );
	
					elseif ( bp_is_user_profile() ) :
						locate_template( array( 'members/single/profile.php'   ), true );
	
					elseif ( bp_is_user_settings() ) :
						locate_template( array( 'members/single/settings.php'  ), true );
	
					// If nothing sticks, load a generic template
					else :
						locate_template( array( 'members/single/plugins.php'   ), true );
	
					endif;
	
					do_action( 'bp_after_member_body' ); ?>
	
				</div><!-- #item-body -->
	
				<?php do_action( 'bp_after_member_home_content' ); ?>
	
			</div><!-- .padder -->
		</div><!-- #content -->
	
	<?php endif; ?>

<?php get_footer( 'buddypress' ); ?>
